/*
 * graphics.h : front-end to platform specific graphics engine
 *
 * Written by T.Pierron, June 2008
 */

#ifndef	SIT_GRAPHICS_P_H
#define	SIT_GRAPHICS_P_H

#include "graphics.h"

typedef struct GC_t     GCBuf;

struct GC_t
{
	HDC      device;
	HBRUSH   fill;       // allocated brush
	HBRUSH   brush;      // old brush from hdc
	Bool     brextern;   // .fill has not been allocated by SIT
	HBITMAP  bitmap;     // offscreen bitmap
	HPEN     pen;        // pen for drawing lines
	HFONT    font;
	Rect     refresh;    // from PAINTSTRUCT
	SIZE     sz;         // GC width and height
	COLORREF fgcolor;
	COLORREF bgcolor;
	HWND     hwnd;
	int      free;       // what field to free()
	int      stage;      // custom paint controls
	APTR     ctrl;       // linked to a control (cached)
	int      inuse;      // ref counter
};

void  GFX_InitGC(GC gc, HWND, HDC, LPRECT ps, HFONT, HBRUSH);
void  GFX_FillLogFont(STRPTR fmt, LPLOGFONT font);
void  GFX_SetSystemFont(LPWSTR fmt);
Image IMG_Read(STRPTR path, int mode);
Image IMG_ReadFromBuf(DATA8 stream, int length, int mode);
Image IMG_ReadFromRes(STRPTR res);

/* 'mode' bitfield:
 * 1 - header only.
 * 2 - raw bitmap: no byte swapping and no pre-multiplication by alpha part.
 */

extern APTR sithfont;

#endif
